OAUTH_STATUS = {
	UNKNOWN:			0,
	UNAUTHENTICATED:	1,
	TOKEN_REQUESTED:	2,
	TOKEN_RECEIVED:		3,
	ACCESS_REQUESTED:	4,
	AUTHENTICATED:		5
};

function TwitterUser() {
	var _oauth_status = OAUTH_STATUS.UNKNOWN;
	var _request_token = null;
	var _request_token_secret = null;
	var _access_token = localStorage["tt_access_token"];
	var _access_token_secret = localStorage["tt_access_token_secret"];
	var _user_id = localStorage["tt_userId"];
	var _screenname = localStorage["tt_screenname"];
	var _profile_image_url = localStorage["tt_profile_image_url"];

	this.SetRequestToken = function(request_token, request_token_secret) {
		_request_token = request_token;
		_request_token_secret = request_token_secret;
	};
	
	this.SetAccessToken = function(access_token, access_token_secret, user_id, screenname) {
		_access_token = access_token;
		_access_token_secret = access_token_secret;
		_user_id = user_id;
		_screenname = screenname;
		
		localStorage["tt_access_token"] = _access_token;
		localStorage["tt_access_token_secret"] = _access_token_secret;
		localStorage["tt_userId"] = _user_id;
		localStorage["tt_screenname"] = _screenname;
	};
	
	this.SetProfile = function(profile_image_url) {
		_profile_image_url = profile_image_url;
		
		localStorage["tt_profile_image_url"] = _profile_image_url;
	};
	
	this.GetRequestToken = function() {
		return _request_token;
	};
	
	this.GetRequestTokenSecret = function() {
		return _request_token_secret;
	};
	
	this.GetAccessToken = function() {
		return _access_token;
	};
	
	this.GetAccessTokenSecret = function() {
		return _access_token_secret;
	};
	
	this.GetScreenname = function() {
		return _screenname;
	};
	
	this.GetImageUrl = function() {
		return _profile_image_url;
	};
	
	this.IsAuthenticating = function() {
		if (!_request_token || _request_token == "undefined" || !_request_token_secret || _request_token_secret == "undefined") {
			return false;
		} else {
			return true;
		}
	};
	
	this.IsAuthenticated = function() {
		if (!_access_token || _access_token == "undefined" || !_access_token_secret || _access_token_secret == "undefined") {
			return false;
		} else {
			return true;
		}
	};
	
	this.GetOAuthStatus = function() {
		return _oauth_status;
	};
	
	this.GetCredentials = function(callback) {
		yqlRequest = new YQLRequest(QUERY.VERIFY_CREDENTIALS, new CredentialParser());
		yqlRequest.onReady = callback;
		yqlHandler.MakeRequest(yqlRequest);
	};
	
	this.Logout = function() {
		_oauth_status = OAUTH_STATUS.UNAUTHENTICATED;
		_request_token = null;
		_request_token_secret = null;
		_access_token = null;
		_access_token_secret = null;
		_user_id = null;
		_screenname = null;
		_profile_image_url = null;
		
		localStorage["tt_access_token"] = "";
		localStorage["tt_access_token_secret"] = "";
		localStorage["tt_userId"] = "";
		localStorage["tt_screenname"] = "";
		localStorage["tt_profile_image_url"] = "";
	};
};